From b48b54732e338d4cb7cd7eff0ad703bb083e7397 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 30 Aug 2014 23:19:38 -0700 Subject: [PATCH] Don't fail!() when rustdoc fails to run The return value of `err.output()` will be `None` if the rustdoc executable failed to spawn, in which case we can give a more graceful error message. Closes #481 --- src/cargo/ops/cargo_rustc/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 6b7254267..e4fe8de04 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -273,8 +273,15 @@ fn rustdoc(package: &Package, target: &Target, cx: &mut Context) -> Work { })) } else { try!(rustdoc.exec_with_output().and(Ok(())).map_err(|err| { - caused_human(format!("Could not document `{}`.\n{}", - name, err.output().unwrap()), err) + match err.output() { + Some(output) => { + caused_human(format!("Could not document `{}`.\n{}", + name, output), err) + } + None => { + caused_human("Failed to run rustdoc", err) + } + } })) } Ok(()) -- 2.30.2